package com.aaa.service.impl;

import com.aaa.dao.F_NeiRongDao;
import com.aaa.service.F_NeiRongservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class F_NeiRongserviceimpl  implements F_NeiRongservice {
    @Autowired
    F_NeiRongDao dao;

    @Override
    public List<Map> selectList(Map map) {
        return dao.selectList(map);
    }

    @Override
    public Integer getCount(Map map) {
        return dao.getCount(map);
    }

    @Override
    public int update(Map map) {
        //根据年份过去id
        int x=  dao.getid(map);
       // System.out.println(x);
        map.put("x",x);
        //根据年份过去id
        String x1=  dao.getname(map);
      //  System.out.println(x1);
        map.put("testproject",x1);
        return dao.update(map);
    }

    @Override
    public int add(Map map) {
        //根据年份过去id
        int x=  dao.getid(map);
       // System.out.println(x);
        map.put("x",x);
        //根据年份过去id
        String x1=dao.getname(map);
       // System.out.println(x1);
        map.put("testproject",x1);
        return dao.add(map);
    }

    @Override
    public int del(Integer id) {
        int g = 1;
        //根据id查询项目名字
       String x= dao.getConter(id);
      //  System.out.println(x);
        //根据项目名 查看此项目  是否正在测试
      List<Map> c= dao.getScore(x);
      //  System.out.println(c);
        //c.size()有值正在测试
      if (c.size()>0) {
        g=4;
      }else {
          dao.del(id);
      }
        return g;
    }

    @Override
    public List<Map> getYear() {

        return dao.getYear();
    }
}
